﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Widgetsphere.Autos.Websitev2.Objects;

namespace Widgetsphere.Autos.Websitev2
{
    public partial class Master : MasterPageBase
    {
        private System.Diagnostics.Stopwatch _pageTimer;

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!this.IsPostBack)
            {
                _pageTimer = new System.Diagnostics.Stopwatch();
                _pageTimer.Start();
            }

        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
        }

        public override bool AllowHeader
        {
            get { return HeaderControl1.Visible; }
            set { HeaderControl1.Visible = value; }
        }

        public override bool AllowFooter
        {
            get { return FooterControl1.Visible; }
            set { FooterControl1.Visible = value; }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            base.Render(writer);

            Trace.Write("MASTER Render BEGIN");
            if (!this.IsPostBack && (_pageTimer != null))
            {
                Trace.Write(_pageTimer.ElapsedMilliseconds.ToString() + "ms Page Render Time");
            }
            Trace.Write("MASTER Render END");

        }

    }
}